package com.fattyCorps.game.controller;


import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import com.fattyCorps.common.obj.msg.server.battle.SBattleResult;
import com.fattyCorps.game.obj.msg.HttpStatus;
import com.fattyCorps.game.obj.msg.SRet;
import com.fattyCorps.game.service.BattleService;
import com.fattyCorps.game.util.GameJwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/battle")
public class BattleController {

    @Autowired
    BattleService battleService;

    @PostMapping("/testPost")
    public SRet testPost(HttpServletRequest request){
        return battleService.test();
    }

    // 挑战主线关卡
    @PostMapping("/mainGuanqia")
    public SRet mainGuanqia(HttpServletRequest request){
        Integer playerId = GameJwtUtils.getPlayerIdByRequest(request);
        return battleService.mainGuanqia(playerId);
    }
}
